package com.zx.mes.rabbitmq.api.hyl.api.exchange.topic;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

/**
 * direct
 *
 * @author huayunlong
 * @date 2018-9-4
 */
public class Producer {
    public static void main(String[] args) throws IOException, TimeoutException {
        ConnectionFactory factory = new ConnectionFactory();
        factory.setUsername("admin");
        factory.setPassword("123456");
        factory.setHost("10.30.90.136");
        factory.setPort(5672);
        factory.setVirtualHost("/");

        Connection connection = factory.newConnection();
        Channel channel = connection.createChannel();

        channel.basicPublish("test.topic","test.add",null,"神不在的星期天topic add!".getBytes());
        channel.basicPublish("test.topic","test.update",null,"神不在的星期天topic update!".getBytes());
        channel.basicPublish("test.topic","test.delete.abc",null,"神不在的星期天topic delete!".getBytes());

        channel.close();
        connection.close();

    }
}
